package chat.fragments;

import android.app.DialogFragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;

import com.whu.zj.R;


/**
 * Created by Administrator on 2016/1/15.
 */
public class ReleaseGroupFragment extends DialogFragment {

    // 要解散的群的id
    String groupID;

    public void setGroupID(String groupID) {
        this.groupID = groupID;
    }

    View v_release;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
        View rootView = inflater.inflate(R.layout.fragment_releaseowngroup,null);
        initview(rootView);
        return rootView;
    }


    private void initview(View rootView) {
        v_release = rootView.findViewById(R.id.id_v_releaseGroup);
        v_release.setOnClickListener(itemclick);
    }

    View.OnClickListener itemclick = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (v == v_release)
            {
                // 解散群组
//                ReleaseGroup.Upload upload = new ReleaseGroup.Upload();
//                upload.setGroupID(groupID);
//                new ReleaseGroup(upload, new ReleaseGroup.Delegate() {
//                    @Override
//                    public void onResponse(String response, ReleaseGroup releaseGroup) {
//                        if (releaseGroup.getDownload().getStatus() == ReleaseGroup.Download.SUCCESS)
//                        {
////                            LoginModel.deleteGroupByID(groupID);
////                            // 通知群组界面刷新
////                            UIHandler.uiHandler.sendEmptyMessage(0x06);
////                            dismiss();
//                        }
//                    }
//
//                    @Override
//                    public void onError(VolleyError error, ReleaseGroup releaseGroup) {
//
//                    }
//                }).delete();
            }


        }
    };
}
